package com.bestv.search.common.model;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class PersonProduct {
    private String id;
    private String personId;
    private String name;
    private String category;
    private int year;
    private String description;
    private Date updateTime;

    // Save info that is online in CMS
    private Map<String, String> onlineInfos = new HashMap<String, String>();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPersonId() {
        return personId;
    }

    public void setPersonId(String personId) {
        this.personId = personId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Map<String, String> getOnlineInfos() {
        return onlineInfos;
    }

    @Override
    public int hashCode() {
        return this.getName().hashCode() + this.getPersonId().hashCode() + this.getCategory().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }

        if (o instanceof PersonProduct) {
            PersonProduct p = (PersonProduct) o;
            return p.getPersonId().equals(this.getPersonId()) && p.getName().equals(this.getName())
                    && p.getCategory().equals(this.getCategory());
        } else {
            return false;
        }
    }
}